home *** CD-ROM | disk | FTP | other *** search
Wrap
RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) NNNNaaaammmmeeee RWpistream - Rogue Wave library class SSSSyyyynnnnooooppppssssiiiissss #include <rw/pstream.h> RWpistream pstr(cin); // Construct an RWpistream, using cin's // streambuf DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn Class RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm specializes the abstract base class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm to restore variables stored in a portable ASCII format by RRRRWWWWppppoooossssttttrrrreeeeaaaammmm. You can think of RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm and RRRRWWWWppppoooossssttttrrrreeeeaaaammmm as an ASCII veneer over an associated ssssttttrrrreeeeaaaammmmbbbbuuuuffff which are responsible for formatting variables and escaping characters such that the results can be interchanged between any machines. As such, they are slower than their binary counterparts RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm and RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm which are more machine dependent. Because RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm and RRRRWWWWppppoooossssttttrrrreeeeaaaammmm retain no information about the state of their associated ssssttttrrrreeeeaaaammmmbbbbuuuuffffs, their use can be freely exchanged with other users of the ssssttttrrrreeeeaaaammmmbbbbuuuuffff (such as iiiissssttttrrrreeeeaaaammmm or iiiiffffssssttttrrrreeeeaaaammmm). RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm can be interrogated as to the stream state using member functions ggggoooooooodddd(((()))), bbbbaaaadddd(((()))), eeeeooooffff(((()))), eeeettttcccc. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee None EEEExxxxaaaammmmpppplllleeee See RRRRWWWWppppoooossssttttrrrreeeeaaaammmm for an example of how to create an input stream for this program. #include <rw/pstream.h> main(){ // Construct an RWpistream to use standard input RWpistream pstr(cin); int i; float f; double d; char string[80]; pstr >> i; // Restore an int that was stored in binary pstr >> f >> d; // Restore a float & double pstr.getString(string, 80); // Restore a character string } PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm(streambuf* s); PPPPaaaaggggeeee 1111 RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) Initialize an RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm from the streambuf ssss. RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm(istream& str); Initialize an RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm using the ssssttttrrrreeeeaaaammmmbbbbuuuuffff associated with the iiiissssttttrrrreeeeaaaammmm ssssttttrrrr. PPPPuuuubbbblllliiiicccc OOOOppppeeeerrrraaaattttoooorrrrssss virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(char& c); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get the next character from the input stream and store it in cccc. This member attempts to preserve the symbolic characters values transmitted over the stream. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(wchar_t& wc); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get the next wwwwiiiiddddeeee cccchhhhaaaarrrr from the input stream and store it in wwwwcccc. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(double& d); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get the next ddddoooouuuubbbblllleeee from the input stream and store it in dddd. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(float& f); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get the next ffffllllooooaaaatttt from the input stream and store it in ffff. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(int& i); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get the next iiiinnnntttt from the input stream and store it in iiii. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(long& l); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get the next lllloooonnnngggg from the input stream and store it in llll. PPPPaaaaggggeeee 2222 RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(short& s); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get the next sssshhhhoooorrrrtttt from the input stream and store it in ssss. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(unsigned char& c); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get the next uuuunnnnssssiiiiggggnnnneeeedddd cccchhhhaaaarrrr from the input stream and store it in cccc. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(unsigned short& s); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get the next uuuunnnnssssiiiiggggnnnneeeedddd sssshhhhoooorrrrtttt from the input stream and store it in ssss. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(unsigned int& i); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get the next uuuunnnnssssiiiiggggnnnneeeedddd iiiinnnntttt from the input stream and store it in iiii. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(unsigned long& l); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get the next uuuunnnnssssiiiiggggnnnneeeedddd lllloooonnnngggg from the input stream and store it in llll. ooooppppeeeerrrraaaattttoooorrrr vvvvooooiiiidddd****(); Inherited via RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm from RRRRWWWWvvvviiiioooossss. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss virtual int ggggeeeetttt(); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get and return the next character from the input stream. Returns EEEEOOOOFFFF if end of file is encountered. virtual RWvistream& ggggeeeetttt(char& c); PPPPaaaaggggeeee 3333 RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get the next char and store it in cccc. This member only preserves ASCII numerical codes, not the coresponding character symbol. virtual RWvistream& ggggeeeetttt(wchar_t& wc); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get the next wwwwiiiiddddeeee cccchhhhaaaarrrr and store it in wwwwcccc. virtual RWvistream& ggggeeeetttt(unsigned char& c); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get the next uuuunnnnssssiiiiggggnnnneeeedddd cccchhhhaaaarrrr and store it in cccc. virtual RWvistream& ggggeeeetttt(char* v, size_t N); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get a vector of cccchhhhaaaarrrrs and store them in the array beginning at vvvv. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason; ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. Note that this member preserves ASCII numerical codes, not their corresponding character values. If you wish to restore a character string, use the function ggggeeeettttSSSSttttrrrriiiinnnngggg((((cccchhhhaaaarrrr****,,,, ssssiiiizzzzeeee____tttt)))).... virtual RWvistream& ggggeeeetttt(wchar_t* v, size_t N); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get a vector of wide cccchhhhaaaarrrrs and store them in the array beginning at vvvv. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason; ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. Note that this member preserves ASCII numerical codes, not their corresponding character values. If you wish to restore a character string, use the function ggggeeeettttSSSSttttrrrriiiinnnngggg((((cccchhhhaaaarrrr****,,,, ssssiiiizzzzeeee____tttt)))).... virtual RWvistream& ggggeeeetttt(double* v, size_t N); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get a vector of ddddoooouuuubbbblllleeees and store them in the array beginning at vvvv. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason; ggggeeeetttt stores what has PPPPaaaaggggeeee 4444 RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) already been retrieved from the stream into vvvv, and sets the failbit. virtual RWvistream& ggggeeeetttt(float* v, size_t N); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get a vector of ffffllllooooaaaatttts and store them in the array beginning at vvvv. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason; ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. virtual RWvistream& ggggeeeetttt(int* v, size_t N); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get a vector of iiiinnnntttts and store them in the array beginning at vvvv. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason; ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. virtual RWvistream& ggggeeeetttt(long* v, size_t N); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get a vector of lllloooonnnnggggs and store them in the array beginning at vvvv. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason; ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. virtual RWvistream& ggggeeeetttt(short* v, size_t N); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get a vector of sssshhhhoooorrrrtttts and store them in the array beginning at vvvv. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason; ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. virtual RWvistream& ggggeeeetttt(unsigned char* v, size_t N); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get a vector of uuuunnnnssssiiiiggggnnnneeeedddd cccchhhhaaaarrrrs and store them in the array beginning at vvvv. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason; ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. Note that this member preserves ASCII numerical codes, not their PPPPaaaaggggeeee 5555 RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) corresponding character values. If you wish to restore a character string, use the function ggggeeeettttSSSSttttrrrriiiinnnngggg((((cccchhhhaaaarrrr****,,,, ssssiiiizzzzeeee____tttt)))).... virtual RWvistream& ggggeeeetttt(unsigned short* v, size_t N); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get a vector of uuuunnnnssssiiiiggggnnnneeeedddd sssshhhhoooorrrrtttts and store them in the array beginning at vvvv. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason; ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. virtual RWvistream& ggggeeeetttt(unsigned int* v, size_t N); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get a vector of uuuunnnnssssiiiiggggnnnneeeedddd iiiinnnntttts and store them in the array beginning at vvvv. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason; ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. virtual RWvistream& ggggeeeetttt(unsigned long* v, size_t N); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Get a vector of uuuunnnnssssiiiiggggnnnneeeedddd lllloooonnnnggggs and store them in the array beginning at vvvv. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason; ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. virtual RWvistream& ggggeeeettttSSSSttttrrrriiiinnnngggg(char* s, size_t N); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Restores a character string from the input stream and stores it in the array beginning at ssss. The function stops reading at the end of the string or after NNNN----1111 characters, whichever comes first. If NNNN----1111 characters have been read and the NNNNtttthhhh character is not the string terminator, then the failbit of the stream will be set. In either case, the string will be terminated with a null byte. If the input stream has been corrupted, then an exception of type RRRRWWWWEEEExxxxtttteeeerrrrnnnnaaaallllEEEErrrrrrrr will be thrown. virtual RWvistream& ggggeeeettttSSSSttttrrrriiiinnnngggg(wchar_t* ws, size_t N); Redefined from class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm. Restores a character string from the input stream and stores it in the array beginning at wwwwssss. The function PPPPaaaaggggeeee 6666 RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) stops reading at the end of the string or after NNNN----1111 characters, whichever comes first. If NNNN----1111 characters have been read and the NNNNtttthhhh character is not the string terminator, then the failbit of the stream will be set. In either case, the string will be terminated with a null byte. If the input stream has been corrupted, then an exception of type RRRRWWWWEEEExxxxtttteeeerrrrnnnnaaaallllEEEErrrrrrrr will be thrown. PPPPaaaaggggeeee 7777